<template>
<view class="padding-logo">
	<view :class="[center ? 'gui-justify-content-center' : '']" class="gui-flex gui-nowrap gui-align-contentItems-center gui-space-between">
		<text class="gui-block gui-primary-color logo-text gui-dark-text-level-2 fb">{{title}}</text>
		<view v-if="showback" style="display: flex;justify-content: space-between;" :style="{flex:showsearch?1:'0'}">
			<!-- 搜索框 -->
			<view v-if="showsearch" class="header-search gui-bg-white gui-dark-bg-level-3 gui-border-box" style="flex:1;padding:0 20px">
				<gui-search @clear="search" clearBtn placeholder="搜索课程" @confirm="search"></gui-search>
			</view>
			<button 
				type="default" 
				@click="handleClick"
				v-if="!showcart"
				style="width:64rpx;height: 60rpx!important;line-height: 60rpx!important;">
					<text class="gui-color-black2 gui-button-text-mini gui-icons fb" style="position: relative;left:-4px;">{{btntext||'&#xe643;'}}</text>
				</button>
				<view class="shopcartbox  pr  tp5" style="left: -10px;" v-if="showcart" @click="toShopcart">
					<text class="gui-icons fb fz22">&#xe60a;</text>
					<text class="num">114</text>
				</view>	
		</view>
	</view>
	<view style="margin-top:18rpx;">
		<text style="font-size:24rpx;" :class="['gui-color-gray', 'gui-block', center ? 'gui-text-center' : '']"><slot>{{desc}}</slot></text>
	</view>
</view>
</template>
<script>
export default {
	name:"logo",
	data() {
		return {
			
		};
	},
	props:{
		showcart:{
			type:Boolean,
			default:false
		},
		showback:{
			type:Boolean,
			default:false
		},
		title : {
			type    : String,
			default : '我是标题' 
		},
		btntext:{
			type: String,
			default:''
		},
		version:{
			type    : String,
			default : 'V1.0' 
		},
		showsearch:{
			type    : Boolean,
			default : true
		},
		desc : { 
			type    : String,
			default : '一款优秀的前端框架 · 更丰富 · 更高效 · 更稳定' 
		},
		center : {
			type    : Boolean,
			default : false
		}
	},
	methods:{
		handleClick(){
			this.$emit("back")
		},
		search(){
			uni.navigateTo({
				url:"/pages/search/search"
			})
		},
		toShopcart(){
			uni.navigateTo({
				url:"/pages/shopcart/shopcart"
			})
		}
	}
}
</script>
<style scoped lang="scss">
.logo-text{font-size:50rpx;}
uni-button:after{border:0;}
</style>
